<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Python API to OpenPACE &#8212; OpenPACE 1.0.3 documentation</title>
    
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/breathe.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootswatch-3.3.6/flatly/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.0.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="_static/js/jquery-fix.js"></script>
    <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Extended Access Control Specification" href="protocols.html" />
    <link rel="prev" title="Programming with OpenPACE" href="programming.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

  </head>
  <body role="document">
  
  <a href="https://github.com/frankmorgner/openpace"
     class="visible-desktop hidden-xs"><img
    id="gh-banner"
    style="position: absolute; top: 50px; right: 0; border: 0;"
    src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
    alt="Fork me on GitHub"></a>
  <script>
    // Adjust banner height.
    $(function () {
      var navHeight = $(".navbar .container").css("height");
      $("#gh-banner").css("top", navHeight);
    });
  </script>


  <div id="navbar" class="navbar navbar-default ">
    <div class="container">
      <div class="navbar-header">
        <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="index.html">
          OpenPACE</a>
        <span class="navbar-text navbar-version pull-left"><b>1.0.3</b></span>
      </div>

        <div class="collapse navbar-collapse nav-collapse">
          <ul class="nav navbar-nav">
            
            
              <li class="dropdown globaltoc-container">
  <a role="button"
     id="dLabelGlobalToc"
     data-toggle="dropdown"
     data-target="#"
     href="index.html">Site <b class="caret"></b></a>
  <ul class="dropdown-menu globaltoc"
      role="menu"
      aria-labelledby="dLabelGlobalToc"><ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Download OpenPACE</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html#compiling-and-installing-openpace">Compiling and Installing OpenPACE</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="usage.html">Usage of OpenPACE</a></li>
<li class="toctree-l1"><a class="reference internal" href="protocols.html">Extended Access Control Specification</a></li>
</ul>
</ul>
</li>
              
                <li class="dropdown">
  <a role="button"
     id="dLabelLocalToc"
     data-toggle="dropdown"
     data-target="#"
     href="#">Page <b class="caret"></b></a>
  <ul class="dropdown-menu localtoc"
      role="menu"
      aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Python API to OpenPACE</a><ul>
<li><a class="reference internal" href="#pace-module">pace Module</a></li>
<li><a class="reference internal" href="#module-pace_entity">pace_entity Module</a></li>
<li><a class="reference internal" href="#module-chat">chat Module</a></li>
</ul>
</li>
</ul>
</ul>
</li>
              
            
            
              
                
  <li>
    <a href="programming.html" title="Previous Chapter: Programming with OpenPACE"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; Programming w...</span>
    </a>
  </li>
  <li>
    <a href="protocols.html" title="Next Chapter: Extended Access Control Specification"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Extended Acce... &raquo;</span>
    </a>
  </li>
              
            
            
            
            
              <li class="hidden-sm"></li>
            
          </ul>

          
            
<form class="navbar-form navbar-right" action="search.html" method="get">
 <div class="form-group">
  <input type="text" name="q" class="form-control" placeholder="Search" />
 </div>
  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>
          
        </div>
    </div>
  </div>

<div class="container">
  <div class="row">
    <div class="col-md-12 content">
      
  <div class="section" id="python-api-to-openpace">
<span id="python-api"></span><h1>Python API to OpenPACE<a class="headerlink" href="#python-api-to-openpace" title="Permalink to this headline">¶</a></h1>
<div class="section" id="pace-module">
<h2>pace Module<a class="headerlink" href="#pace-module" title="Permalink to this headline">¶</a></h2>
<p>This is the native python wrapper generated by SWIG. It includes all exported
functions and identifiers from OpenPACE. See the SWIG interface files
(<code class="file docutils literal"><span class="pre">*.i</span></code>) in the <code class="file docutils literal"><span class="pre">bindings</span></code> directory for details.</p>
<span class="target" id="module-eac"></span><p>Below you can find the documentation for two wrappers based on the eac module.</p>
</div>
<div class="section" id="module-pace_entity">
<span id="pace-entity-module"></span><h2>pace_entity Module<a class="headerlink" href="#module-pace_entity" title="Permalink to this headline">¶</a></h2>
<p>Object oriented wrapper for PACE entities, the PICC and the PCD structure
and related methods from OpenPACE</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body">Dominik Oepen</td>
</tr>
<tr class="field-even field"><th class="field-name">Date:</th><td class="field-body">23.02.2012</td>
</tr>
<tr class="field-odd field"><th class="field-name">License:</th><td class="field-body">GPL</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="pace_entity.PACEEntity">
<em class="property">class </em><code class="descclassname">pace_entity.</code><code class="descname">PACEEntity</code><span class="sig-paren">(</span><em>pin</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for all class implementing the PACE protocol</p>
<dl class="method">
<dt id="pace_entity.PACEEntity.EAC_CTX_set_encryption_ctx">
<code class="descname">EAC_CTX_set_encryption_ctx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.EAC_CTX_set_encryption_ctx" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.EAC_Comp">
<code class="descname">EAC_Comp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.EAC_Comp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.authenticate">
<code class="descname">authenticate</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.authenticate" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute a MAC for block of data using the secret established by the
PACE protocol. This method can only be used after a successful run of
eac.</p>
</dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.compute_shared_secret">
<code class="descname">compute_shared_secret</code><span class="sig-paren">(</span><em>pubkey</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.compute_shared_secret" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.decrypt">
<code class="descname">decrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.decrypt" title="Permalink to this definition">¶</a></dt>
<dd><p>Decrypt a block of data using the secret established by the PACE
protocol. This method can only be used after a successful run of eac.</p>
</dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.derive_keys">
<code class="descname">derive_keys</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.derive_keys" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.encrypt">
<code class="descname">encrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.encrypt" title="Permalink to this definition">¶</a></dt>
<dd><p>Encrypt a block of data using the secret established by the PACE
protocol. This method can only be used after a successful run of eac.</p>
</dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.generate_ephemeral_pubkey">
<code class="descname">generate_ephemeral_pubkey</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.generate_ephemeral_pubkey" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.get_static_pubkey">
<code class="descname">get_static_pubkey</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.get_static_pubkey" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PACEEntity.perform_mapping">
<code class="descname">perform_mapping</code><span class="sig-paren">(</span><em>pubkey</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEEntity.perform_mapping" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="exception">
<dt id="pace_entity.PACEException">
<em class="property">exception </em><code class="descclassname">pace_entity.</code><code class="descname">PACEException</code><span class="sig-paren">(</span><em>reason</em>, <em>protocol_step=None</em>, <em>role=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PACEException" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="class">
<dt id="pace_entity.PCD">
<em class="property">class </em><code class="descclassname">pace_entity.</code><code class="descname">PCD</code><span class="sig-paren">(</span><em>pin</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PCD" title="Permalink to this definition">¶</a></dt>
<dd><p>Proximity coupling device</p>
<dl class="method">
<dt id="pace_entity.PCD.decrypt_nonce">
<code class="descname">decrypt_nonce</code><span class="sig-paren">(</span><em>enc_nonce</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PCD.decrypt_nonce" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PCD.get_authentication_token">
<code class="descname">get_authentication_token</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PCD.get_authentication_token" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="pace_entity.PICC">
<em class="property">class </em><code class="descclassname">pace_entity.</code><code class="descname">PICC</code><span class="sig-paren">(</span><em>pin</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PICC" title="Permalink to this definition">¶</a></dt>
<dd><p>This class implements the PACE protocol stepts that are only needed for
the Proximity integrated circuit card</p>
<dl class="method">
<dt id="pace_entity.PICC.generate_nonce">
<code class="descname">generate_nonce</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PICC.generate_nonce" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="pace_entity.PICC.verify_authentication_token">
<code class="descname">verify_authentication_token</code><span class="sig-paren">(</span><em>token</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.PICC.verify_authentication_token" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="pace_entity.hexdump">
<code class="descclassname">pace_entity.</code><code class="descname">hexdump</code><span class="sig-paren">(</span><em>data</em>, <em>indent=0</em>, <em>short=False</em>, <em>linelen=16</em>, <em>offset=0</em><span class="sig-paren">)</span><a class="headerlink" href="#pace_entity.hexdump" title="Permalink to this definition">¶</a></dt>
<dd><p>Generates a nice hexdump of data and returns it. Consecutive lines will
be indented with indent spaces. When short is true, will instead generate
hexdump without adresses and on one line.</p>
<p>Examples:
hexdump(&#8216;A&#8217;) -&gt;     &#8216;0000:  00 41                                             .A              &#8216;
hexdump(&#8216;A&#8217;, short=True) -&gt; &#8216;00 41 (.A)&#8217;</p>
</dd></dl>

</div>
<div class="section" id="module-chat">
<span id="chat-module"></span><h2>chat Module<a class="headerlink" href="#module-chat" title="Permalink to this headline">¶</a></h2>
<p>Object oriented wrapper for the CVC_CHAT structure and related methods from
OpenPACE</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body">Dominik Oepen</td>
</tr>
<tr class="field-even field"><th class="field-name">Date:</th><td class="field-body">04.12.2011</td>
</tr>
<tr class="field-odd field"><th class="field-name">License:</th><td class="field-body">GPL</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="chat.CHAT">
<em class="property">class </em><code class="descclassname">chat.</code><code class="descname">CHAT</code><span class="sig-paren">(</span><em>chat</em><span class="sig-paren">)</span><a class="headerlink" href="#chat.CHAT" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="chat.CHAT.get_relative_authorizations">
<code class="descname">get_relative_authorizations</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CHAT.get_relative_authorizations" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CHAT.get_role">
<code class="descname">get_role</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CHAT.get_role" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CHAT.get_terminal_type">
<code class="descname">get_terminal_type</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CHAT.get_terminal_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="chat.CVC">
<em class="property">class </em><code class="descclassname">chat.</code><code class="descname">CVC</code><span class="sig-paren">(</span><em>asn1_string</em><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="chat.CVC.get_car">
<code class="descname">get_car</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC.get_car" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CVC.get_chr">
<code class="descname">get_chr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC.get_chr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CVC.get_effective_date">
<code class="descname">get_effective_date</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC.get_effective_date" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CVC.get_expiration_date">
<code class="descname">get_expiration_date</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC.get_expiration_date" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="chat.CVC.get_profile_identifier">
<code class="descname">get_profile_identifier</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#chat.CVC.get_profile_identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="chat.EAC_CTX">
<em class="property">class </em><code class="descclassname">chat.</code><code class="descname">EAC_CTX</code><a class="headerlink" href="#chat.EAC_CTX" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="chat.OpenPACEException">
<em class="property">exception </em><code class="descclassname">chat.</code><code class="descname">OpenPACEException</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#chat.OpenPACEException" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="class">
<dt id="chat.PACE_SEC">
<em class="property">class </em><code class="descclassname">chat.</code><code class="descname">PACE_SEC</code><span class="sig-paren">(</span><em>secret</em>, <em>secret_type</em><span class="sig-paren">)</span><a class="headerlink" href="#chat.PACE_SEC" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
</div>


    </div>
      
  </div>
</div>
<footer class="footer">
  <div class="container">
    <p class="pull-right">
      <a href="#">Back to top</a>
      
    </p>
    <p>
        &copy; Copyright 2012-2018 by Frank Morgner and Dominik Oepen.<br/>
    </p>
  </div>
</footer>
  </body>
</html>